package com.xinqi.modules.sys.dict.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.sys.dict.dto.req.SchoolQueryDTO;
import com.xinqi.modules.sys.dict.dto.rsp.SchoolResultDTO;
import com.xinqi.modules.sys.dict.service.SchoolService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 学校表内部控制层
 *
 * @author: wenjie
 * @date: 2023/05/19
 */
@Hidden
@RestController
@RequestMapping("/inner/school")
@RequiredArgsConstructor
public class SchoolInnerController {
    private final SchoolService schoolService;

    /**
     * 学校表-分页
     */
    @GetMapping("/page")
    public R<PageInfo<SchoolResultDTO>> page(Param pageable, SchoolQueryDTO dto) {
        PageInfo<SchoolResultDTO> page = schoolService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 学校表-详情
     */
    @GetMapping("/{id}")
    public R<SchoolResultDTO> findById(@PathVariable("id") Long id) {
        SchoolResultDTO dto = schoolService.findById(id);
        return R.data(dto);
    }
}
